﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace DrawableObjects
{
    /// <summary>
    /// This class struct represents a vertex of the terrain.
    /// </summary>
    public struct VertexTerrain
    {
        /// <summary>
        /// The position of a vertex.
        /// </summary>
        public Vector3 position;

        /// <summary>
        /// The calculated normal related to this vertex.
        /// </summary>
        public Vector3 normal;

        /// <summary>
        /// The texture coordinate of this vertex.
        /// </summary>
        public Vector4 textureCoordinate;

        /// <summary>
        /// The weight of the moon textures
        /// </summary>
        public Vector4 texWeightsMoon;

        /// <summary>
        /// The weight of the mars textures
        /// </summary>
        public Vector4 texWeightsMars;

        /// <summary>
        /// The weight of the lava textures
        /// </summary>
        public Vector4 texWeightsLava;


        public static readonly VertexDeclaration vertexDeclaration = new VertexDeclaration(
             new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
             new VertexElement(sizeof(float) * 3, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
             new VertexElement(sizeof(float) * 6, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 0),
             new VertexElement(sizeof(float) * 10, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 1),
             new VertexElement(sizeof(float) * 14, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 2),
             new VertexElement(sizeof(float) * 18, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 3)
         );
    }
}
